/* eslint-disable prettier/prettier */
import { BasicColumn, FormSchema } from '@/components/Table';
import { ifShow, ifDescription } from '@/utils/schema_util'
/**
 * 表格列配置
 */
export const tableColumns: BasicColumn[] = [
  {
    title: '角色名称',
    dataIndex: 'name',
    component: 'Input',
    componentProps: {
      placeholder: "请输入角色名称",
    }
  },
  {
    title: '唯一编码',
    dataIndex: 'code',
    component: 'Input',
    componentProps: {
      placeholder: "请输入唯一编码",
    }
  },
  {
    title: '角色类型',
    dataIndex: 'roleType',
    component: 'ApiDict',
    componentProps: {
      code: "sys_role_type",
      dataType: "number",
      placeholder: "请选择角色类型",
    }
  },
  {
    title: '是否启用',
    dataIndex: 'enabled',
    component: 'ApiDict',
    componentProps: {
      code: "yes_no",
      dataType: "number",
      renderType: "RadioGroup",
      placeholder: "请选择是否启用",
      isBtn: true,
    }
  },
  {
    title: '备注',
    dataIndex: 'remark',
    component: 'InputTextArea',
    componentProps: {
      showCount: true,
      placeholder: "请输入备注",
    }
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    component: 'Input',
    componentProps: {
      placeholder: "请输入创建时间",
    }
  },
  {
    title: '操作',
    dataIndex: '__ACTION__',
  },
];
/**
 * 搜索表单配置
 */
export const searchFormSchemas: FormSchema[] = [
  {
    label: '角色名称',
    field: 'm_t_LIKE_name',
    component: 'Input',
    componentProps: {
      placeholder: "请输入角色名称",
    } as any,
    colProps: { span: 6 },
  },
  {
    label: '唯一编码',
    field: 'm_LIKE_code',
    component: 'Input',
    componentProps: {
      placeholder: "请输入唯一编码",
    } as any,
    colProps: { span: 6 },
  },
];

/**
 * 新增、编辑表单配置
 */
export const formSchemas: FormSchema[] = [
  {
    field: 'id',
    label: '角色ID',
    component: 'Input',
    show: false,
    description: false,
    componentProps: {
      type: "hidden",
      placeholder: "请输入角色ID",
    } as any,
    required: false,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"addHide":1,"editHide":0,"listHide":1,"viewHide":1,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"Input_type":"hidden"}
      return ifShow(data,ext);
    },
  },
  {
    field: 'name',
    label: '角色名称',
    component: 'Input',
    description: (data) => {
      const ext = {"searchType":"LIKE","addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":1,"search":1,"tableAlias":"t","searchSpan":6}
      return ifDescription(data,ext);
    },
    componentProps: {
      placeholder: "请输入角色名称",
    } as any,
    required: true,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"searchType":"LIKE","addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":1,"search":1,"tableAlias":"t","searchSpan":6}
      return ifShow(data,ext);
    },
  },
  {
    field: 'code',
    label: '唯一编码',
    component: 'Input',
    description: (data) => {
      const ext = {"searchType":"LIKE","addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":1,"search":1}
      return ifDescription(data,ext);
    },
    componentProps: {
      placeholder: "请输入唯一编码",
    } as any,
    required: true,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"searchType":"LIKE","addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":1,"search":1}
      return ifShow(data,ext);
    },
  },
  {
    field: 'roleType',
    label: '角色类型',
    component: 'ApiDict',
    description: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"ApiDict_code":"sys_role_type","ApiDict_dataType":"number","popupContainerInBody":false}
      return ifDescription(data,ext);
    },
    defaultValue: 1,
    componentProps: {
      code: "sys_role_type",
      dataType: "number",
      placeholder: "请选择角色类型",
    } as any,
    required: false,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"ApiDict_code":"sys_role_type","ApiDict_dataType":"number","popupContainerInBody":false}
      return ifShow(data,ext);
    },
  },
  {
    field: 'enabled',
    label: '是否启用',
    component: 'ApiDict',
    description: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"ApiDict_code":"yes_no","ApiDict_dataType":"number","ApiDict_renderType":"RadioGroup","popupContainerInBody":false}
      return ifDescription(data,ext);
    },
    defaultValue: 1,
    componentProps: {
      code: "yes_no",
      dataType: "number",
      renderType: "RadioGroup",
      placeholder: "请选择是否启用",
      isBtn: true,
    } as any,
    required: false,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"ApiDict_code":"yes_no","ApiDict_dataType":"number","ApiDict_renderType":"RadioGroup","popupContainerInBody":false}
      return ifShow(data,ext);
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    description: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"InputTextArea_showCount":true,"controlledFieldName":"roleType","controlledFieldValue":"2,3"}
      return ifDescription(data,ext);
    },
    componentProps: {
      showCount: true,
      placeholder: "请输入备注",
    } as any,
    required: false,
    colProps: { span: 24 },
    ifShow: (data) => {
      const ext = {"addHide":0,"editHide":0,"listHide":0,"viewHide":0,"addDisabled":0,"editDisabled":0,"required":0,"search":0,"InputTextArea_showCount":true,"controlledFieldName":"roleType","controlledFieldValue":"2,3"}
      return ifShow(data,ext);
    },
  },
];
